﻿namespace WinForms.ControlList.Stock
{
    using Bll.Stock;
    using Bll.Supplier;
    using Bll.Systems;
    using Model.Stock;
    using Model.Systems;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;
    using WinForms;
    using WinForms.ControlList.Comm;
    using WinForms.Properties;

    public class FrmStockAdd : Form
    {
        private Button btn_Close;
        private Button btn_Save;
        private IContainer components = null;
        private ComboBoxNew drp_CommUnit;
        private ComboBoxNew drp_DlId;
        private ComboBoxNew drp_Supplier;
        public const int HTCAPTION = 2;
        private Label lbl_Amount;
        private Label lbl_AmoutMoney;
        private Label lbl_AmoutUnit;
        private Label lbl_BiTian;
        private Label lbl_CommId;
        private Label lbl_CommName;
        private Label lbl_CommTypeId;
        private Label lbl_DlId;
        private Label lbl_LotNum;
        private Label lbl_SupplierListId;
        private Label lbl_TiShi;
        private Label lbl_TiShi2;
        private Label lblTitle;
        private LinkLabel link_AddComm;
        private LinkLabel link_AddDl;
        private Panel pan_AllPanel;
        private Panel pan_AllPlanes;
        private Panel pan_Bottoms;
        private Panel pan_Dock;
        private Panel pan_DockBottom;
        private Panel pan_DockLeft;
        private Panel pan_DockRight;
        private Panel pan_Lefts;
        private Panel pan_Rights;
        private Panel pan_Table1;
        private Panel pan_Table2;
        private Panel pan_Table3;
        private Panel pan_Table4;
        private Panel pan_td0;
        private Panel pan_td1;
        private Panel pan_td10;
        private Panel pan_td11;
        private Panel pan_td12;
        private Panel pan_td13;
        private Panel pan_td14;
        private Panel pan_td15;
        private Panel pan_td4;
        private Panel pan_td5;
        private Panel pan_td6;
        private Panel pan_td7;
        private Panel pan_td8;
        private Panel pan_td9;
        private Panel pan_Top;
        private Panel pan_TopLeft;
        private Panel pan_TopRight;
        private Panel pan_ZhongJian;
        private Panel pane_TopT;
        private Panel panel_BiTian;
        private Panel panel_Button;
        private Panel panel9;
        public FrmPrompt prom = null;
        public const int SC_MOVE = 0xf010;
        private FrmSelectComm selectComm = null;
        private TextBox txt_Amount;
        private TextBox txt_AmoutMoney;
        private TextBox txt_CommName;
        private TextBox txt_LotNum;
        public const int WM_SYSCOMMAND = 0x112;

        public FrmStockAdd()
        {
            this.InitializeComponent();
            base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            base.SetStyle(ControlStyles.UserPaint, true);
            base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.loadDl();
            this.LoadSupplier();
            this.LoadNewLotNum();
            this.LoadCommUnit();
            this.txt_CommName.Select();
            base.KeyPreview = true;
            base.KeyDown += new KeyEventHandler(this.Form_KeyDown);
        }

        private void btn_Close_Click(object sender, EventArgs e)
        {
            if (this.selectComm != null)
            {
                this.selectComm.Dispose();
            }
            base.DialogResult = DialogResult.Cancel;
            base.Close();
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {
            Exception exception;
            try
            {
                if (this.txt_LotNum.Text.Trim() == "")
                {
                    this.prom = new FrmPrompt(false, "请输入批号");
                    this.prom.ShowDialog();
                }
                else if (this.drp_DlId.SelectValueNew.Trim() == "")
                {
                    this.prom = new FrmPrompt(false, "请选择所入仓库");
                    this.prom.ShowDialog();
                    this.drp_DlId.Focus();
                }
                else if (this.txt_CommName.Text.Trim() == "")
                {
                    this.prom = new FrmPrompt(false, "请选择商品名称");
                    this.prom.ShowDialog();
                    this.txt_CommName.Focus();
                }
                else if (this.drp_CommUnit.SelectValueNew.Trim() == "")
                {
                    this.prom = new FrmPrompt(false, "请选择数量单位!");
                    this.prom.ShowDialog();
                    this.drp_CommUnit.Focus();
                }
                else if (this.txt_Amount.Text.Trim() == "")
                {
                    this.prom = new FrmPrompt(false, "请输入数量!");
                    this.prom.ShowDialog();
                    this.txt_Amount.Focus();
                }
                else if (this.txt_AmoutMoney.Text.Trim() == "")
                {
                    this.prom = new FrmPrompt(false, "请输入成本价");
                    this.prom.ShowDialog();
                    this.txt_AmoutMoney.Focus();
                }
                else
                {
                    UserEnt loginUser = PublicAppliction.LoginUser;
                    StockEnt model = new StockEnt {
                        LotNum = this.txt_LotNum.Text.Trim(),
                        DlId = int.Parse(this.drp_DlId.SelectValueNew),
                        CommName = this.txt_CommName.Text.Trim(),
                        CommId = int.Parse(this.lbl_CommId.Text),
                        ProcurementId = 0,
                        TimeExpired = DateTime.Now,
                        ChainNum = loginUser.ChainNum,
                        CommTypeId = int.Parse(this.lbl_CommTypeId.Text),
                        SupplierListId = this.drp_Supplier.SelectValueNew,
                        AmoutUnit = int.Parse(this.drp_CommUnit.SelectValueNew),
                        Amount = decimal.Parse(this.txt_Amount.Text.Trim()),
                        AmoutMoney = decimal.Parse(this.txt_AmoutMoney.Text.Trim())
                    };
                    StockBll.Add(model);
                    GoodsInOutEnt ent3 = new GoodsInOutEnt {
                        ChainNum = loginUser.ChainNum,
                        DetailsType = 0,
                        LibraryTypeId = 0x22,
                        UserId = loginUser.UserId,
                        CreateTime = DateTime.Now
                    };
                    GoodsInOutBll.Add(ent3);
                    int maxId = GoodsInOutBll.GetMaxId("ChainNum=" + loginUser.ChainNum);
                    LibraryDetailsCommEnt ent4 = new LibraryDetailsCommEnt {
                        DetailsId = maxId,
                        LotNum = this.txt_LotNum.Text,
                        ChainNum = loginUser.ChainNum,
                        SupplierId = "0",
                        CommId = int.Parse(this.lbl_CommId.Text),
                        CommName = this.txt_CommName.Text
                    };
                    try
                    {
                        ent4.DlId = int.Parse(this.drp_DlId.SelectValueNew);
                    }
                    catch (Exception exception1)
                    {
                        exception = exception1;
                        ent4.DlId = 0;
                    }
                    ent4.InputPrice = decimal.Parse(this.txt_AmoutMoney.Text);
                    ent4.Amount = decimal.Parse(this.txt_Amount.Text.Trim());
                    ent4.AmoutUnit = int.Parse(this.drp_CommUnit.SelectValueNew);
                    ent4.Remark = "";
                    ent4.ResidualMoney = 0M;
                    ent4.ResidualNum = 0M;
                    LibraryDetailsCommBll.Add(ent4);
                    if (this.selectComm != null)
                    {
                        this.selectComm.Dispose();
                    }
                    this.prom = new FrmPrompt(true, "库存增加成功");
                    this.prom.Show();
                    WorkLogBll.AddNewLog("库存增加成功", "FrmStockAdd", PublicAppliction.LoginUser);
                    base.DialogResult = DialogResult.OK;
                    base.Close();
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                ErrorsBll.NewException(exception, PublicAppliction.LoginUser);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void drp_CommUnit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                this.txt_AmoutMoney.Select();
            }
        }

        private void drp_DlId_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                this.txt_LotNum.Select();
            }
        }

        private void drp_Supplier_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (this.drp_Supplier.SelectValueNew == "")
                {
                    this.drp_Supplier.Select();
                }
                else
                {
                    this.btn_Save.Select();
                }
            }
        }

        protected void Form_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.Control && (e.KeyCode == Keys.S)) && (MessageBox.Show("您确定要保存吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK))
            {
                this.btn_Save_Click(null, null);
            }
        }

        private void InitializeComponent()
        {
            this.pan_ZhongJian = new Panel();
            this.lblTitle = new Label();
            this.pan_TopRight = new Panel();
            this.pan_DockLeft = new Panel();
            this.pan_Dock = new Panel();
            this.pan_AllPanel = new Panel();
            this.pan_AllPlanes = new Panel();
            this.pan_Table4 = new Panel();
            this.pan_td15 = new Panel();
            this.drp_Supplier = new ComboBoxNew();
            this.pan_td14 = new Panel();
            this.lbl_SupplierListId = new Label();
            this.pan_td13 = new Panel();
            this.txt_AmoutMoney = new TextBox();
            this.pan_td12 = new Panel();
            this.lbl_AmoutMoney = new Label();
            this.pan_Table3 = new Panel();
            this.pan_td11 = new Panel();
            this.drp_CommUnit = new ComboBoxNew();
            this.pan_td10 = new Panel();
            this.lbl_AmoutUnit = new Label();
            this.pan_td9 = new Panel();
            this.txt_Amount = new TextBox();
            this.pan_td8 = new Panel();
            this.lbl_Amount = new Label();
            this.pan_Table2 = new Panel();
            this.pan_td7 = new Panel();
            this.link_AddComm = new LinkLabel();
            this.txt_CommName = new TextBox();
            this.pan_td6 = new Panel();
            this.lbl_CommName = new Label();
            this.pan_td5 = new Panel();
            this.txt_LotNum = new TextBox();
            this.pan_td4 = new Panel();
            this.lbl_LotNum = new Label();
            this.pan_Table1 = new Panel();
            this.pan_td1 = new Panel();
            this.link_AddDl = new LinkLabel();
            this.lbl_CommTypeId = new Label();
            this.lbl_CommId = new Label();
            this.drp_DlId = new ComboBoxNew();
            this.pan_td0 = new Panel();
            this.lbl_DlId = new Label();
            this.panel_BiTian = new Panel();
            this.lbl_BiTian = new Label();
            this.panel_Button = new Panel();
            this.lbl_TiShi2 = new Label();
            this.lbl_TiShi = new Label();
            this.btn_Close = new Button();
            this.btn_Save = new Button();
            this.panel9 = new Panel();
            this.pan_Rights = new Panel();
            this.pan_Lefts = new Panel();
            this.pan_Bottoms = new Panel();
            this.pane_TopT = new Panel();
            this.pan_DockBottom = new Panel();
            this.pan_DockRight = new Panel();
            this.pan_Top = new Panel();
            this.pan_TopLeft = new Panel();
            this.pan_ZhongJian.SuspendLayout();
            this.pan_Dock.SuspendLayout();
            this.pan_AllPanel.SuspendLayout();
            this.pan_AllPlanes.SuspendLayout();
            this.pan_Table4.SuspendLayout();
            this.pan_td15.SuspendLayout();
            this.pan_td14.SuspendLayout();
            this.pan_td13.SuspendLayout();
            this.pan_td12.SuspendLayout();
            this.pan_Table3.SuspendLayout();
            this.pan_td11.SuspendLayout();
            this.pan_td10.SuspendLayout();
            this.pan_td9.SuspendLayout();
            this.pan_td8.SuspendLayout();
            this.pan_Table2.SuspendLayout();
            this.pan_td7.SuspendLayout();
            this.pan_td6.SuspendLayout();
            this.pan_td5.SuspendLayout();
            this.pan_td4.SuspendLayout();
            this.pan_Table1.SuspendLayout();
            this.pan_td1.SuspendLayout();
            this.pan_td0.SuspendLayout();
            this.panel_BiTian.SuspendLayout();
            this.panel_Button.SuspendLayout();
            this.pan_Top.SuspendLayout();
            base.SuspendLayout();
            this.pan_ZhongJian.BackgroundImage = Resources.uc_title_2;
            this.pan_ZhongJian.Controls.Add(this.lblTitle);
            this.pan_ZhongJian.Dock = DockStyle.Fill;
            this.pan_ZhongJian.Location = new Point(0x1f, 0);
            this.pan_ZhongJian.Name = "pan_ZhongJian";
            this.pan_ZhongJian.Size = new Size(0x312, 0x20);
            this.pan_ZhongJian.TabIndex = 2;
            this.pan_ZhongJian.MouseDown += new MouseEventHandler(this.pan_ZhongJian_MouseDown);
            this.lblTitle.AutoSize = true;
            this.lblTitle.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.lblTitle.Font = new Font("宋体", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lblTitle.ForeColor = Color.FromArgb(0x3b, 0x56, 20);
            this.lblTitle.Location = new Point(6, 8);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(0x3f, 13);
            this.lblTitle.TabIndex = 0;
            this.lblTitle.Text = "新增库存";
            this.pan_TopRight.BackgroundImage = Resources.uc_title_1;
            this.pan_TopRight.Dock = DockStyle.Right;
            this.pan_TopRight.Location = new Point(0x331, 0);
            this.pan_TopRight.Name = "pan_TopRight";
            this.pan_TopRight.Size = new Size(5, 0x20);
            this.pan_TopRight.TabIndex = 1;
            this.pan_DockLeft.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockLeft.Dock = DockStyle.Left;
            this.pan_DockLeft.Location = new Point(0, 0);
            this.pan_DockLeft.Name = "pan_DockLeft";
            this.pan_DockLeft.Size = new Size(1, 0xc9);
            this.pan_DockLeft.TabIndex = 0;
            this.pan_Dock.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.pan_Dock.Controls.Add(this.pan_AllPanel);
            this.pan_Dock.Controls.Add(this.pan_DockBottom);
            this.pan_Dock.Controls.Add(this.pan_DockRight);
            this.pan_Dock.Controls.Add(this.pan_DockLeft);
            this.pan_Dock.Dock = DockStyle.Fill;
            this.pan_Dock.Location = new Point(0, 0x20);
            this.pan_Dock.Name = "pan_Dock";
            this.pan_Dock.Size = new Size(0x336, 0xc9);
            this.pan_Dock.TabIndex = 5;
            this.pan_AllPanel.BackColor = Color.White;
            this.pan_AllPanel.Controls.Add(this.pan_AllPlanes);
            this.pan_AllPanel.Controls.Add(this.pan_Rights);
            this.pan_AllPanel.Controls.Add(this.pan_Lefts);
            this.pan_AllPanel.Controls.Add(this.pan_Bottoms);
            this.pan_AllPanel.Controls.Add(this.pane_TopT);
            this.pan_AllPanel.Dock = DockStyle.Fill;
            this.pan_AllPanel.Location = new Point(1, 0);
            this.pan_AllPanel.Name = "pan_AllPanel";
            this.pan_AllPanel.Size = new Size(820, 200);
            this.pan_AllPanel.TabIndex = 3;
            this.pan_AllPlanes.Controls.Add(this.pan_Table4);
            this.pan_AllPlanes.Controls.Add(this.pan_Table3);
            this.pan_AllPlanes.Controls.Add(this.pan_Table2);
            this.pan_AllPlanes.Controls.Add(this.pan_Table1);
            this.pan_AllPlanes.Controls.Add(this.panel_BiTian);
            this.pan_AllPlanes.Controls.Add(this.panel_Button);
            this.pan_AllPlanes.Controls.Add(this.panel9);
            this.pan_AllPlanes.Dock = DockStyle.Fill;
            this.pan_AllPlanes.Location = new Point(10, 10);
            this.pan_AllPlanes.Name = "pan_AllPlanes";
            this.pan_AllPlanes.Size = new Size(800, 180);
            this.pan_AllPlanes.TabIndex = 4;
            this.pan_Table4.Controls.Add(this.pan_td15);
            this.pan_Table4.Controls.Add(this.pan_td14);
            this.pan_Table4.Controls.Add(this.pan_td13);
            this.pan_Table4.Controls.Add(this.pan_td12);
            this.pan_Table4.Dock = DockStyle.Top;
            this.pan_Table4.Location = new Point(0, 100);
            this.pan_Table4.Name = "pan_Table4";
            this.pan_Table4.Size = new Size(800, 0x19);
            this.pan_Table4.TabIndex = 0;
            this.pan_td15.Controls.Add(this.drp_Supplier);
            this.pan_td15.Dock = DockStyle.Left;
            this.pan_td15.Location = new Point(550, 0);
            this.pan_td15.Name = "pan_td15";
            this.pan_td15.Size = new Size(250, 0x19);
            this.pan_td15.TabIndex = 0;
            this.pan_td15.Paint += new PaintEventHandler(this.pan_td15_Paint);
            this.drp_Supplier.DisplayMember = "Name";
            this.drp_Supplier.DropDownStyle = ComboBoxStyle.DropDownList;
            this.drp_Supplier.FormattingEnabled = true;
            this.drp_Supplier.Location = new Point(3, 2);
            this.drp_Supplier.Name = "drp_Supplier";
            this.drp_Supplier.SelectValueNew = "";
            this.drp_Supplier.Size = new Size(230, 20);
            this.drp_Supplier.TabIndex = 6;
            this.drp_Supplier.ValueMember = "Value";
            this.drp_Supplier.KeyPress += new KeyPressEventHandler(this.drp_Supplier_KeyPress);
            this.pan_td14.Controls.Add(this.lbl_SupplierListId);
            this.pan_td14.Dock = DockStyle.Left;
            this.pan_td14.Location = new Point(400, 0);
            this.pan_td14.Name = "pan_td14";
            this.pan_td14.Size = new Size(150, 0x19);
            this.pan_td14.TabIndex = 1;
            this.pan_td14.Paint += new PaintEventHandler(this.pan_td14_Paint);
            this.lbl_SupplierListId.Location = new Point(60, 6);
            this.lbl_SupplierListId.Name = "lbl_SupplierListId";
            this.lbl_SupplierListId.Size = new Size(0x54, 12);
            this.lbl_SupplierListId.TabIndex = 0;
            this.lbl_SupplierListId.Text = "供货商:";
            this.lbl_SupplierListId.TextAlign = ContentAlignment.MiddleRight;
            this.pan_td13.Controls.Add(this.txt_AmoutMoney);
            this.pan_td13.Dock = DockStyle.Left;
            this.pan_td13.Location = new Point(150, 0);
            this.pan_td13.Name = "pan_td13";
            this.pan_td13.Size = new Size(250, 0x19);
            this.pan_td13.TabIndex = 2;
            this.pan_td13.Paint += new PaintEventHandler(this.pan_td13_Paint);
            this.txt_AmoutMoney.Location = new Point(3, 2);
            this.txt_AmoutMoney.MaxLength = 20;
            this.txt_AmoutMoney.Name = "txt_AmoutMoney";
            this.txt_AmoutMoney.Size = new Size(230, 0x15);
            this.txt_AmoutMoney.TabIndex = 5;
            this.txt_AmoutMoney.Text = "0.00";
            this.txt_AmoutMoney.KeyPress += new KeyPressEventHandler(this.txt_AmoutMoney_KeyPress);
            this.pan_td12.Controls.Add(this.lbl_AmoutMoney);
            this.pan_td12.Dock = DockStyle.Left;
            this.pan_td12.Location = new Point(0, 0);
            this.pan_td12.Name = "pan_td12";
            this.pan_td12.Size = new Size(150, 0x19);
            this.pan_td12.TabIndex = 3;
            this.pan_td12.Paint += new PaintEventHandler(this.pan_td12_Paint);
            this.lbl_AmoutMoney.Location = new Point(0x3e, 5);
            this.lbl_AmoutMoney.Name = "lbl_AmoutMoney";
            this.lbl_AmoutMoney.Size = new Size(0x54, 12);
            this.lbl_AmoutMoney.TabIndex = 0;
            this.lbl_AmoutMoney.Text = "成本价:";
            this.lbl_AmoutMoney.TextAlign = ContentAlignment.MiddleRight;
            this.pan_Table3.Controls.Add(this.pan_td11);
            this.pan_Table3.Controls.Add(this.pan_td10);
            this.pan_Table3.Controls.Add(this.pan_td9);
            this.pan_Table3.Controls.Add(this.pan_td8);
            this.pan_Table3.Dock = DockStyle.Top;
            this.pan_Table3.Location = new Point(0, 0x4b);
            this.pan_Table3.Name = "pan_Table3";
            this.pan_Table3.Size = new Size(800, 0x19);
            this.pan_Table3.TabIndex = 1;
            this.pan_td11.Controls.Add(this.drp_CommUnit);
            this.pan_td11.Dock = DockStyle.Left;
            this.pan_td11.Location = new Point(550, 0);
            this.pan_td11.Name = "pan_td11";
            this.pan_td11.Size = new Size(250, 0x19);
            this.pan_td11.TabIndex = 0;
            this.pan_td11.Paint += new PaintEventHandler(this.pan_td11_Paint);
            this.drp_CommUnit.DisplayMember = "Name";
            this.drp_CommUnit.DropDownStyle = ComboBoxStyle.DropDownList;
            this.drp_CommUnit.FormattingEnabled = true;
            this.drp_CommUnit.Location = new Point(3, 2);
            this.drp_CommUnit.Name = "drp_CommUnit";
            this.drp_CommUnit.SelectValueNew = "";
            this.drp_CommUnit.Size = new Size(230, 20);
            this.drp_CommUnit.TabIndex = 4;
            this.drp_CommUnit.ValueMember = "Value";
            this.drp_CommUnit.KeyPress += new KeyPressEventHandler(this.drp_CommUnit_KeyPress);
            this.pan_td10.Controls.Add(this.lbl_AmoutUnit);
            this.pan_td10.Dock = DockStyle.Left;
            this.pan_td10.Location = new Point(400, 0);
            this.pan_td10.Name = "pan_td10";
            this.pan_td10.Size = new Size(150, 0x19);
            this.pan_td10.TabIndex = 1;
            this.pan_td10.Paint += new PaintEventHandler(this.pan_td10_Paint);
            this.lbl_AmoutUnit.Location = new Point(0x3e, 5);
            this.lbl_AmoutUnit.Name = "lbl_AmoutUnit";
            this.lbl_AmoutUnit.Size = new Size(0x54, 12);
            this.lbl_AmoutUnit.TabIndex = 0;
            this.lbl_AmoutUnit.Text = "商品单位:";
            this.lbl_AmoutUnit.TextAlign = ContentAlignment.MiddleRight;
            this.pan_td9.Controls.Add(this.txt_Amount);
            this.pan_td9.Dock = DockStyle.Left;
            this.pan_td9.Location = new Point(150, 0);
            this.pan_td9.Name = "pan_td9";
            this.pan_td9.Size = new Size(250, 0x19);
            this.pan_td9.TabIndex = 2;
            this.pan_td9.Paint += new PaintEventHandler(this.pan_td9_Paint);
            this.txt_Amount.Location = new Point(3, 2);
            this.txt_Amount.MaxLength = 20;
            this.txt_Amount.Name = "txt_Amount";
            this.txt_Amount.Size = new Size(230, 0x15);
            this.txt_Amount.TabIndex = 3;
            this.txt_Amount.Text = "0.00";
            this.txt_Amount.KeyPress += new KeyPressEventHandler(this.txt_Amount_KeyPress);
            this.pan_td8.Controls.Add(this.lbl_Amount);
            this.pan_td8.Dock = DockStyle.Left;
            this.pan_td8.Location = new Point(0, 0);
            this.pan_td8.Name = "pan_td8";
            this.pan_td8.Size = new Size(150, 0x19);
            this.pan_td8.TabIndex = 3;
            this.pan_td8.Paint += new PaintEventHandler(this.pan_td8_Paint);
            this.lbl_Amount.Location = new Point(0x3e, 5);
            this.lbl_Amount.Name = "lbl_Amount";
            this.lbl_Amount.Size = new Size(0x54, 12);
            this.lbl_Amount.TabIndex = 0;
            this.lbl_Amount.Text = "数量:";
            this.lbl_Amount.TextAlign = ContentAlignment.MiddleRight;
            this.pan_Table2.Controls.Add(this.pan_td7);
            this.pan_Table2.Controls.Add(this.pan_td6);
            this.pan_Table2.Controls.Add(this.pan_td5);
            this.pan_Table2.Controls.Add(this.pan_td4);
            this.pan_Table2.Dock = DockStyle.Top;
            this.pan_Table2.Location = new Point(0, 50);
            this.pan_Table2.Name = "pan_Table2";
            this.pan_Table2.Size = new Size(800, 0x19);
            this.pan_Table2.TabIndex = 2;
            this.pan_td7.Controls.Add(this.link_AddComm);
            this.pan_td7.Controls.Add(this.txt_CommName);
            this.pan_td7.Dock = DockStyle.Left;
            this.pan_td7.Location = new Point(550, 0);
            this.pan_td7.Name = "pan_td7";
            this.pan_td7.Size = new Size(250, 0x19);
            this.pan_td7.TabIndex = 0;
            this.pan_td7.Paint += new PaintEventHandler(this.pan_td7_Paint);
            this.link_AddComm.AutoSize = true;
            this.link_AddComm.Location = new Point(180, 7);
            this.link_AddComm.Name = "link_AddComm";
            this.link_AddComm.Size = new Size(0x35, 12);
            this.link_AddComm.TabIndex = 5;
            this.link_AddComm.TabStop = true;
            this.link_AddComm.Text = "新增商品";
            this.link_AddComm.LinkClicked += new LinkLabelLinkClickedEventHandler(this.link_AddComm_LinkClicked);
            this.txt_CommName.Location = new Point(3, 2);
            this.txt_CommName.MaxLength = 20;
            this.txt_CommName.Name = "txt_CommName";
            this.txt_CommName.Size = new Size(0xab, 0x15);
            this.txt_CommName.TabIndex = 2;
            this.txt_CommName.MouseClick += new MouseEventHandler(this.txt_CommName_MouseClick);
            this.txt_CommName.KeyPress += new KeyPressEventHandler(this.txt_CommName_KeyPress);
            this.pan_td6.Controls.Add(this.lbl_CommName);
            this.pan_td6.Dock = DockStyle.Left;
            this.pan_td6.Location = new Point(400, 0);
            this.pan_td6.Name = "pan_td6";
            this.pan_td6.Size = new Size(150, 0x19);
            this.pan_td6.TabIndex = 1;
            this.pan_td6.Paint += new PaintEventHandler(this.pan_td6_Paint);
            this.lbl_CommName.Location = new Point(0x3f, 5);
            this.lbl_CommName.Name = "lbl_CommName";
            this.lbl_CommName.Size = new Size(0x54, 12);
            this.lbl_CommName.TabIndex = 0;
            this.lbl_CommName.Text = "商品名称:";
            this.lbl_CommName.TextAlign = ContentAlignment.MiddleRight;
            this.pan_td5.Controls.Add(this.txt_LotNum);
            this.pan_td5.Dock = DockStyle.Left;
            this.pan_td5.Location = new Point(150, 0);
            this.pan_td5.Name = "pan_td5";
            this.pan_td5.Size = new Size(250, 0x19);
            this.pan_td5.TabIndex = 2;
            this.pan_td5.Paint += new PaintEventHandler(this.pan_td5_Paint);
            this.txt_LotNum.Location = new Point(3, 2);
            this.txt_LotNum.MaxLength = 20;
            this.txt_LotNum.Name = "txt_LotNum";
            this.txt_LotNum.Size = new Size(230, 0x15);
            this.txt_LotNum.TabIndex = 1;
            this.txt_LotNum.KeyPress += new KeyPressEventHandler(this.txt_LotNum_KeyPress);
            this.pan_td4.Controls.Add(this.lbl_LotNum);
            this.pan_td4.Dock = DockStyle.Left;
            this.pan_td4.Location = new Point(0, 0);
            this.pan_td4.Name = "pan_td4";
            this.pan_td4.Size = new Size(150, 0x19);
            this.pan_td4.TabIndex = 3;
            this.pan_td4.Paint += new PaintEventHandler(this.pan_td4_Paint);
            this.lbl_LotNum.Location = new Point(60, 5);
            this.lbl_LotNum.Name = "lbl_LotNum";
            this.lbl_LotNum.Size = new Size(0x54, 12);
            this.lbl_LotNum.TabIndex = 0;
            this.lbl_LotNum.Text = "批号:";
            this.lbl_LotNum.TextAlign = ContentAlignment.MiddleRight;
            this.pan_Table1.Controls.Add(this.pan_td1);
            this.pan_Table1.Controls.Add(this.pan_td0);
            this.pan_Table1.Dock = DockStyle.Top;
            this.pan_Table1.Location = new Point(0, 0x19);
            this.pan_Table1.Name = "pan_Table1";
            this.pan_Table1.Size = new Size(800, 0x19);
            this.pan_Table1.TabIndex = 3;
            this.pan_td1.Controls.Add(this.link_AddDl);
            this.pan_td1.Controls.Add(this.lbl_CommTypeId);
            this.pan_td1.Controls.Add(this.lbl_CommId);
            this.pan_td1.Controls.Add(this.drp_DlId);
            this.pan_td1.Dock = DockStyle.Fill;
            this.pan_td1.Location = new Point(150, 0);
            this.pan_td1.Name = "pan_td1";
            this.pan_td1.Size = new Size(650, 0x19);
            this.pan_td1.TabIndex = 2;
            this.pan_td1.Paint += new PaintEventHandler(this.pan_td1_Paint);
            this.link_AddDl.AutoSize = true;
            this.link_AddDl.Location = new Point(0xef, 6);
            this.link_AddDl.Name = "link_AddDl";
            this.link_AddDl.Size = new Size(0x35, 12);
            this.link_AddDl.TabIndex = 0xc9;
            this.link_AddDl.TabStop = true;
            this.link_AddDl.Text = "新增仓库";
            this.link_AddDl.LinkClicked += new LinkLabelLinkClickedEventHandler(this.link_AddDl_LinkClicked);
            this.lbl_CommTypeId.AutoSize = true;
            this.lbl_CommTypeId.Location = new Point(0x1ac, 5);
            this.lbl_CommTypeId.Name = "lbl_CommTypeId";
            this.lbl_CommTypeId.Size = new Size(0, 12);
            this.lbl_CommTypeId.TabIndex = 200;
            this.lbl_CommTypeId.Visible = false;
            this.lbl_CommId.AutoSize = true;
            this.lbl_CommId.Location = new Point(0x215, 5);
            this.lbl_CommId.Name = "lbl_CommId";
            this.lbl_CommId.Size = new Size(0, 12);
            this.lbl_CommId.TabIndex = 0xc7;
            this.lbl_CommId.Visible = false;
            this.drp_DlId.DisplayMember = "Name";
            this.drp_DlId.DropDownStyle = ComboBoxStyle.DropDownList;
            this.drp_DlId.FormattingEnabled = true;
            this.drp_DlId.Location = new Point(3, 2);
            this.drp_DlId.Name = "drp_DlId";
            this.drp_DlId.SelectValueNew = "";
            this.drp_DlId.Size = new Size(230, 20);
            this.drp_DlId.TabIndex = 0;
            this.drp_DlId.ValueMember = "Value";
            this.drp_DlId.KeyPress += new KeyPressEventHandler(this.drp_DlId_KeyPress);
            this.pan_td0.Controls.Add(this.lbl_DlId);
            this.pan_td0.Dock = DockStyle.Left;
            this.pan_td0.Location = new Point(0, 0);
            this.pan_td0.Name = "pan_td0";
            this.pan_td0.Size = new Size(150, 0x19);
            this.pan_td0.TabIndex = 3;
            this.pan_td0.Paint += new PaintEventHandler(this.pan_td0_Paint);
            this.lbl_DlId.Location = new Point(0x3e, 5);
            this.lbl_DlId.Name = "lbl_DlId";
            this.lbl_DlId.Size = new Size(0x54, 12);
            this.lbl_DlId.TabIndex = 0;
            this.lbl_DlId.Text = "所入仓库:";
            this.lbl_DlId.TextAlign = ContentAlignment.MiddleRight;
            this.panel_BiTian.Controls.Add(this.lbl_BiTian);
            this.panel_BiTian.Dock = DockStyle.Top;
            this.panel_BiTian.Location = new Point(0, 0);
            this.panel_BiTian.Name = "panel_BiTian";
            this.panel_BiTian.Size = new Size(800, 0x19);
            this.panel_BiTian.TabIndex = 4;
            this.panel_BiTian.Paint += new PaintEventHandler(this.panel_BiTian_Paint);
            this.lbl_BiTian.AutoSize = true;
            this.lbl_BiTian.Location = new Point(10, 6);
            this.lbl_BiTian.Name = "lbl_BiTian";
            this.lbl_BiTian.Size = new Size(0x35, 12);
            this.lbl_BiTian.TabIndex = 0;
            this.lbl_BiTian.Text = "库存信息";
            this.panel_Button.Controls.Add(this.lbl_TiShi2);
            this.panel_Button.Controls.Add(this.lbl_TiShi);
            this.panel_Button.Controls.Add(this.btn_Close);
            this.panel_Button.Controls.Add(this.btn_Save);
            this.panel_Button.Dock = DockStyle.Bottom;
            this.panel_Button.Location = new Point(0, 0x84);
            this.panel_Button.Name = "panel_Button";
            this.panel_Button.Size = new Size(800, 0x2b);
            this.panel_Button.TabIndex = 5;
            this.panel_Button.Paint += new PaintEventHandler(this.panel_Button_Paint);
            this.lbl_TiShi2.AutoSize = true;
            this.lbl_TiShi2.Location = new Point(0x236, 15);
            this.lbl_TiShi2.Name = "lbl_TiShi2";
            this.lbl_TiShi2.Size = new Size(0xe3, 12);
            this.lbl_TiShi2.TabIndex = 12;
            this.lbl_TiShi2.Text = "使用小技巧: Ctrl+S 快速保存 库存信息.";
            this.lbl_TiShi.AutoSize = true;
            this.lbl_TiShi.Location = new Point(10, 15);
            this.lbl_TiShi.Name = "lbl_TiShi";
            this.lbl_TiShi.Size = new Size(0xef, 12);
            this.lbl_TiShi.TabIndex = 11;
            this.lbl_TiShi.Text = "使用小技巧:回车(Enter)跳到下一个输入项.";
            this.btn_Close.Location = new Point(0x1ad, 10);
            this.btn_Close.Name = "btn_Close";
            this.btn_Close.Size = new Size(0x4b, 0x17);
            this.btn_Close.TabIndex = 9;
            this.btn_Close.Text = "关 闭";
            this.btn_Close.UseVisualStyleBackColor = true;
            this.btn_Close.Click += new EventHandler(this.btn_Close_Click);
            this.btn_Save.Location = new Point(0x128, 10);
            this.btn_Save.Name = "btn_Save";
            this.btn_Save.Size = new Size(0x4b, 0x17);
            this.btn_Save.TabIndex = 7;
            this.btn_Save.Text = "保 存";
            this.btn_Save.UseVisualStyleBackColor = true;
            this.btn_Save.Click += new EventHandler(this.btn_Save_Click);
            this.panel9.Dock = DockStyle.Bottom;
            this.panel9.Location = new Point(0, 0xaf);
            this.panel9.Name = "panel9";
            this.panel9.Size = new Size(800, 5);
            this.panel9.TabIndex = 3;
            this.pan_Rights.Dock = DockStyle.Right;
            this.pan_Rights.Location = new Point(810, 10);
            this.pan_Rights.Name = "pan_Rights";
            this.pan_Rights.Size = new Size(10, 180);
            this.pan_Rights.TabIndex = 3;
            this.pan_Lefts.Dock = DockStyle.Left;
            this.pan_Lefts.Location = new Point(0, 10);
            this.pan_Lefts.Name = "pan_Lefts";
            this.pan_Lefts.Size = new Size(10, 180);
            this.pan_Lefts.TabIndex = 2;
            this.pan_Bottoms.Dock = DockStyle.Bottom;
            this.pan_Bottoms.Location = new Point(0, 190);
            this.pan_Bottoms.Name = "pan_Bottoms";
            this.pan_Bottoms.Size = new Size(820, 10);
            this.pan_Bottoms.TabIndex = 1;
            this.pane_TopT.Dock = DockStyle.Top;
            this.pane_TopT.Location = new Point(0, 0);
            this.pane_TopT.Name = "pane_TopT";
            this.pane_TopT.Size = new Size(820, 10);
            this.pane_TopT.TabIndex = 0;
            this.pan_DockBottom.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockBottom.Dock = DockStyle.Bottom;
            this.pan_DockBottom.Location = new Point(1, 200);
            this.pan_DockBottom.Name = "pan_DockBottom";
            this.pan_DockBottom.Size = new Size(820, 1);
            this.pan_DockBottom.TabIndex = 2;
            this.pan_DockRight.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockRight.Dock = DockStyle.Right;
            this.pan_DockRight.Location = new Point(0x335, 0);
            this.pan_DockRight.Name = "pan_DockRight";
            this.pan_DockRight.Size = new Size(1, 0xc9);
            this.pan_DockRight.TabIndex = 1;
            this.pan_Top.Controls.Add(this.pan_ZhongJian);
            this.pan_Top.Controls.Add(this.pan_TopRight);
            this.pan_Top.Controls.Add(this.pan_TopLeft);
            this.pan_Top.Dock = DockStyle.Top;
            this.pan_Top.Location = new Point(0, 0);
            this.pan_Top.Name = "pan_Top";
            this.pan_Top.Size = new Size(0x336, 0x20);
            this.pan_Top.TabIndex = 4;
            this.pan_TopLeft.BackgroundImage = Resources.uc_title;
            this.pan_TopLeft.Dock = DockStyle.Left;
            this.pan_TopLeft.Location = new Point(0, 0);
            this.pan_TopLeft.Name = "pan_TopLeft";
            this.pan_TopLeft.Size = new Size(0x1f, 0x20);
            this.pan_TopLeft.TabIndex = 0;
            this.pan_TopLeft.MouseDown += new MouseEventHandler(this.pan_TopLeft_MouseDown);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x336, 0xe9);
            base.Controls.Add(this.pan_Dock);
            base.Controls.Add(this.pan_Top);
            base.FormBorderStyle = FormBorderStyle.None;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FrmStockAdd";
            base.ShowIcon = false;
            base.ShowInTaskbar = false;
            this.pan_ZhongJian.ResumeLayout(false);
            this.pan_ZhongJian.PerformLayout();
            this.pan_Dock.ResumeLayout(false);
            this.pan_AllPanel.ResumeLayout(false);
            this.pan_AllPlanes.ResumeLayout(false);
            this.pan_Table4.ResumeLayout(false);
            this.pan_td15.ResumeLayout(false);
            this.pan_td14.ResumeLayout(false);
            this.pan_td13.ResumeLayout(false);
            this.pan_td13.PerformLayout();
            this.pan_td12.ResumeLayout(false);
            this.pan_Table3.ResumeLayout(false);
            this.pan_td11.ResumeLayout(false);
            this.pan_td10.ResumeLayout(false);
            this.pan_td9.ResumeLayout(false);
            this.pan_td9.PerformLayout();
            this.pan_td8.ResumeLayout(false);
            this.pan_Table2.ResumeLayout(false);
            this.pan_td7.ResumeLayout(false);
            this.pan_td7.PerformLayout();
            this.pan_td6.ResumeLayout(false);
            this.pan_td5.ResumeLayout(false);
            this.pan_td5.PerformLayout();
            this.pan_td4.ResumeLayout(false);
            this.pan_Table1.ResumeLayout(false);
            this.pan_td1.ResumeLayout(false);
            this.pan_td1.PerformLayout();
            this.pan_td0.ResumeLayout(false);
            this.panel_BiTian.ResumeLayout(false);
            this.panel_BiTian.PerformLayout();
            this.panel_Button.ResumeLayout(false);
            this.panel_Button.PerformLayout();
            this.pan_Top.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void link_AddComm_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FrmCommAdd add = new FrmCommAdd();
            if (add.ShowDialog() == DialogResult.OK)
            {
                this.txt_CommName.Text = add.NewCommName;
                this.lbl_CommId.Text = add.NewCommId;
                this.lbl_CommTypeId.Text = add.NewCommTypeId;
            }
            add.Dispose();
        }

        private void link_AddDl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                FrmDigitallibraryAdd add = new FrmDigitallibraryAdd();
                if (add.ShowDialog() == DialogResult.OK)
                {
                    this.loadDl();
                }
            }
            catch (Exception)
            {
            }
        }

        private void LoadCommUnit()
        {
            this.drp_CommUnit.BeginUpdate();
            this.drp_CommUnit.Items.Clear();
            this.drp_CommUnit.AddItem("---请选择---", "");
            DataRow[] rowArray = PublicAppliction.ParDt.Select("parrefname='numberUnit'");
            foreach (DataRow row in rowArray)
            {
                this.drp_CommUnit.AddItem(row["ParName"].ToString(), row["ParId"].ToString());
            }
            this.drp_CommUnit.SelectedIndex = 0;
            this.drp_CommUnit.EndUpdate();
        }

        private void loadDl()
        {
            UserEnt loginUser = PublicAppliction.LoginUser;
            DataRow[] rowArray = PublicAppliction.DlDt.Select("ChainNum=" + loginUser.ChainNum);
            this.drp_DlId.BeginUpdate();
            this.drp_DlId.Items.Clear();
            this.drp_DlId.AddItem("---请选择---", "");
            foreach (DataRow row in rowArray)
            {
                this.drp_DlId.AddItem(row["DlName"].ToString(), row["DlId"].ToString());
            }
            if (rowArray.Length <= 0)
            {
                MessageBox.Show("您仍未设置仓库,请先设置后再行操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                this.drp_DlId.SelectedIndex = 0;
                this.drp_DlId.EndUpdate();
            }
        }

        private void LoadNewLotNum()
        {
            string str = IdocumentCodeBll.GetMaxValue2("CommPiHao");
            if (str.Length == 1)
            {
                str = "00" + str;
            }
            if (str.Length == 2)
            {
                str = "0" + str;
            }
            this.txt_LotNum.Text = DateTime.Now.ToString("yyyyMMdd") + str;
            this.txt_LotNum.Enabled = false;
        }

        private void LoadSupplier()
        {
            this.drp_Supplier.BeginUpdate();
            UserEnt loginUser = PublicAppliction.LoginUser;
            DataTable list = SupplierBll.GetList("ChainNum=" + loginUser.ChainNum);
            this.drp_Supplier.Items.Clear();
            this.drp_Supplier.AddItem("---请选择---", "");
            foreach (DataRow row in list.Rows)
            {
                this.drp_Supplier.AddItem(row["SupplierName"].ToString(), row["SupplierId"].ToString());
            }
            this.drp_Supplier.SelectedIndex = 0;
            this.drp_Supplier.EndUpdate();
        }

        private void pan_td0_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td0, Color.FromArgb(0xca, 0xc9, 0xce), 1, 0, 1, 1);
        }

        private void pan_td1_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td1, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td10_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td10, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td11_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td11, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td12_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td12, Color.FromArgb(0xca, 0xc9, 0xce), 1, 0, 1, 1);
        }

        private void pan_td13_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td13, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td14_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td14, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td15_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td15, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td4_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td4, Color.FromArgb(0xca, 0xc9, 0xce), 1, 0, 1, 1);
        }

        private void pan_td5_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td5, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td6_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td6, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td7_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td7, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_td8_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td8, Color.FromArgb(0xca, 0xc9, 0xce), 1, 0, 1, 1);
        }

        private void pan_td9_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.pan_td9, Color.FromArgb(0xca, 0xc9, 0xce), 0, 0, 1, 1);
        }

        private void pan_TopLeft_MouseDown(object sender, MouseEventArgs e)
        {
            ReleaseCapture();
            SendMessage(base.Handle, 0x112, 0xf012, 0);
        }

        private void pan_ZhongJian_MouseDown(object sender, MouseEventArgs e)
        {
            ReleaseCapture();
            SendMessage(base.Handle, 0x112, 0xf012, 0);
        }

        private void panel_BiTian_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.panel_BiTian, Color.FromArgb(0xca, 0xc9, 0xce), 1, 1, 1, 1);
        }

        private void panel_Button_Paint(object sender, PaintEventArgs e)
        {
            this.Panel_ResetPaint(e, this.panel_Button, Color.FromArgb(0xca, 0xc9, 0xce), 1, 1, 1, 1);
        }

        private void Panel_ResetPaint(PaintEventArgs e, Panel panel, Color color, int leftBoder, int topBoder, int rightBoder, int bottomBoder)
        {
            ControlPaint.DrawBorder(e.Graphics, panel.ClientRectangle, color, leftBoder, ButtonBorderStyle.Solid, color, topBoder, ButtonBorderStyle.Solid, color, rightBoder, ButtonBorderStyle.Solid, color, bottomBoder, ButtonBorderStyle.Solid);
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            return ((keyData == Keys.Tab) || base.ProcessCmdKey(ref msg, keyData));
        }

        [DllImport("user32.dll")]
        public static extern bool ReleaseCapture();
        [DllImport("user32.dll")]
        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
        private void txt_Amount_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((((e.KeyChar < '0') || (e.KeyChar > '9')) && (e.KeyChar != '\b')) && (e.KeyChar != '.'))
            {
                e.Handled = true;
            }
            if (e.KeyChar == '\r')
            {
                this.drp_CommUnit.Select();
            }
        }

        private void txt_AmoutMoney_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((((e.KeyChar < '0') || (e.KeyChar > '9')) && (e.KeyChar != '\b')) && (e.KeyChar != '.'))
            {
                e.Handled = true;
            }
            if (e.KeyChar == '\r')
            {
                try
                {
                    if (decimal.Parse(this.txt_AmoutMoney.Text) > 0M)
                    {
                        this.drp_Supplier.Select();
                    }
                }
                catch (Exception)
                {
                    this.txt_AmoutMoney.Text = "";
                    this.txt_AmoutMoney.Select();
                }
            }
        }

        private void txt_CommName_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                this.txt_CommName_MouseClick(null, null);
            }
        }

        private void txt_CommName_MouseClick(object sender, MouseEventArgs e)
        {
            if (this.selectComm == null)
            {
                this.selectComm = new FrmSelectComm();
            }
            if (this.selectComm.ShowDialog() == DialogResult.OK)
            {
                this.lbl_CommId.Text = this.selectComm.SelectComm.CommId.ToString();
                this.txt_CommName.Text = this.selectComm.SelectComm.CommName;
                this.lbl_CommTypeId.Text = this.selectComm.SelectComm.CommTypeId.ToString();
                this.drp_CommUnit.SelectValueNew = this.selectComm.SelectComm.CommUnit;
                if ((this.selectComm.SelectComm.CommDefaultDlId.ToString() != "") && (this.selectComm.SelectComm.CommDefaultDlId.ToString() != "0"))
                {
                    this.drp_DlId.SelectValueNew = this.selectComm.SelectComm.CommDefaultDlId.ToString();
                }
                this.txt_Amount.Select();
            }
        }

        private void txt_LotNum_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                this.txt_CommName.Select();
            }
        }
    }
}

